function update(event)
{
	var nodeAdded = event.target;
	if (nodeAdded.className.indexOf("tweet-text") != -1)
	{
		var firstUnicode = nodeAdded.innerText.charCodeAt(0);
		if((firstUnicode >= 1536 && firstUnicode<=1791)			// Arabic alphabet
			|| (firstUnicode >= 1424 && firstUnicode<=1535))	// Hebrew alphabet
		{
			nodeAdded.setAttribute('dir', 'rtl');
			nodeAdded.setAttribute('align', 'right');
		}
	}
}

document.addEventListener('DOMNodeInsertedIntoDocument', update, true);